-
Notifications
You must be signed in to change notification settings - Fork 0
USER BAN
ElbyFross edited this page Jan 20, 2020
·
3 revisions
An IQueryHandler
that creates a new user.
- Located at the
AuthorityController.Queries
namespace into theUSER_NEW
class. - Sets a temporaly or permanent ban for some user.
- You define which rights will be bannes.
- The rank of requesting user must be higher than the rank of user that will banned.
By default requires following rights from a requester:
banhammer
-
>rank=2
- at least moderator
Required rights could be modified via the Config by change the QUERY_UserBan_RIGHTS field
's value.
The query must contains all the listed parameters.
Keyword | Description |
---|---|
user |
id or login of the user that will be banned. |
ban | A BanInformation instance that describes the ban serialized to binary format. |
token | A guest token provided to a client app. |
guid | An unique GUID of the query. |
In case if banned success the returns success
message using the UniformServer.BaseServer.SendAnswerViaPP
.
Error | Message |
---|---|
User not found | "ERROR 404: User not found" |
Invalid SQL query | "ERROR SQL SERVER: DATAILS ", where DATAILS is an asnwer of the SQL server. |
Target user has undefined rank | "ERROR 401: User rank not defined" |
Not enough rights | "ERROR 401: Unauthorized" |
The following example demostrates executing of the USER BAN
query.
In that example will permanently banned a logon
right for some user.
// Building ban information.
BanInformation banInformation = BanInformation.Permanent;
banInformation.blockedRights = new string[] { "logon" };
// Building query.
Query query = new Query(
new QueryPart("token", TOKEN),
new QueryPart("guid", "banUserExample"),
new QueryPart("user", "USER_ID_FOR_BAN"),
new QueryPart("ban", banInformation));
// Start reciving clent line.
UniformClient.BaseClient.EnqueueDuplexQueryViaPP(
// Request connection to localhost server via main pipe.
SERVER_IP, PIPE_NAME,
query,
// Handler that will recives a server's answer.
(PipesProvider.Client.TransmissionLine line, Query answer) =>
{
string answerS = answer.First.PropertyValueString;
if(answerS.StartsWith("error", StringComparison.OrdinalIgnoreCase))
{
// An error occured.
}
});
- Where
TOKEN
is an unique session token provided to an app\user by theSessionProvider
server or by some custom equivalent. - Where the
SERVER_IP
is an ip adress or the name of the computer into a local network. - Where the
PIPE_NAME
is a name of the named pipe started on the server. - Where the
USER_ID_FOR_BAN
is anid
orlogin
of aUser
that will banned.
-
UDO Tests from the ACTests. Look at the
UserBan
method. -
Queries Tests from the ACTests. Look at the
UserBan
method. -
MainWindow from the Datum Point. Look at the
UserBan_FullCycle
orUserBan_ModeratorToAdmin
, orUserBan_NoRights
methods.
- Donate: Why support the initiative? | Patreon
- Contacts: LinkedIn
- See also: WPF Handler | Uniform Data Operator | Datum Point