mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
ef5c253c51
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com> Signed-off-by: dusan <borovcanindusan1@gmail.com> Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package policies
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const (
|
|
GroupsKind = "groups"
|
|
NewGroupKind = "new_group"
|
|
ChannelsKind = "channels"
|
|
NewChannelKind = "new_channel"
|
|
ClientsKind = "clients"
|
|
NewClientKind = "new_client"
|
|
UsersKind = "users"
|
|
DomainsKind = "domains"
|
|
PlatformKind = "platform"
|
|
)
|
|
|
|
const (
|
|
RoleType = "role"
|
|
GroupType = "group"
|
|
ClientType = "client"
|
|
ChannelType = "channel"
|
|
UserType = "user"
|
|
DomainType = "domain"
|
|
PlatformType = "platform"
|
|
RulesType = "rules"
|
|
ReportsType = "reports"
|
|
AlarmsType = "alarms"
|
|
)
|
|
|
|
const (
|
|
AdministratorRelation = "administrator"
|
|
EditorRelation = "editor"
|
|
ContributorRelation = "contributor"
|
|
MemberRelation = "member"
|
|
DomainRelation = "domain"
|
|
ParentGroupRelation = "parent_group"
|
|
RoleGroupRelation = "role_group"
|
|
GroupRelation = "group"
|
|
PlatformRelation = "platform"
|
|
GuestRelation = "guest"
|
|
)
|
|
|
|
const (
|
|
AdminPermission = "admin"
|
|
DeletePermission = "delete"
|
|
EditPermission = "edit"
|
|
ViewPermission = "view"
|
|
MembershipPermission = "membership"
|
|
SharePermission = "share"
|
|
PublishPermission = "publish"
|
|
SubscribePermission = "subscribe"
|
|
CreatePermission = "create"
|
|
)
|
|
|
|
const MagistralaObject = "magistrala"
|
|
|
|
type Evaluator interface {
|
|
// CheckPolicy checks if the subject has a relation on the object.
|
|
// It returns a non-nil error if the subject has no relation on
|
|
// the object (which simply means the operation is denied).
|
|
CheckPolicy(ctx context.Context, pr Policy) error
|
|
}
|