Documentation ¶
Index ¶
- Constants
- Variables
- type AttributeGroup
- func (attrg *AttributeGroup) CanAccess(attribute int) (bool, error)
- func (attrg *AttributeGroup) CanDelete(attribute int) (bool, error)
- func (attrg *AttributeGroup) CanInvite(userRole int) (bool, error)
- func (attrg *AttributeGroup) CanManage(attribute int) (bool, error)
- func (attrg *AttributeGroup) CanManageSpecial(attribute int) (bool, error)
- func (attrg *AttributeGroup) CanModify(attribute, fromID, toID int) (bool, error)
- func (attrg *AttributeGroup) DoesNowUserAreEditorOrViewer() bool
- func (attrg *AttributeGroup) Init()
- func (attrg *AttributeGroup) SetTeamID(teamID int)
- func (attrg *AttributeGroup) SetUnitID(unitID int)
- func (attrg *AttributeGroup) SetUnitType(unitType int)
- func (attrg *AttributeGroup) SetUserAuthToken(token string)
- func (attrg *AttributeGroup) SetUserRole(userRole int)
Constants ¶
View Source
const ( UNIT_TYPE_TEAM = iota + 1 // cloud team UNIT_TYPE_TEAM_MEMBER // cloud team member UNIT_TYPE_USER // cloud user UNIT_TYPE_INVITE // cloud invite UNIT_TYPE_DOMAIN // cloud domain UNIT_TYPE_BILLING // cloud billing UNIT_TYPE_BUILDER_DASHBOARD // builder dabshboard UNIT_TYPE_APP // builder app UNIT_TYPE_COMPONENTS // builder components UNIT_TYPE_RESOURCE // resource resource UNIT_TYPE_ACTION // resource action UNIT_TYPE_INTERNAL_ACTION // internal action UNIT_TYPE_TRANSFORMER // resource transformer UNIT_TYPE_JOB // hub job )
Attirbute Unit List
View Source
const ( USER_ROLE_OWNER = 1 USER_ROLE_ADMIN = 2 USER_ROLE_EDITOR = 3 USER_ROLE_VIEWER = 4 )
User Role ID in Team @note: this will extend as role system later.
View Source
const ( // Basic Attribute ACTION_ACCESS_VIEW = iota + 1 // 访问 Attribute // Invite Attribute ACTION_ACCESS_INVITE_BY_LINK // invite team member by link ACTION_ACCESS_INVITE_BY_EMAIL // invite team member by email ACTION_ACCESS_INVITE_OWNER // can invite team member as an owner ACTION_ACCESS_INVITE_ADMIN // can invite team member as an admin ACTION_ACCESS_INVITE_EDITOR // can invite team member as an editor ACTION_ACCESS_INVITE_VIEWER // can invite team member as a viewer )
Attribute List action access
View Source
const ( // Team Attribute ACTION_MANAGE_TEAM_NAME = iota + 1 // rename Team Attribute ACTION_MANAGE_TEAM_ICON // update icon ACTION_MANAGE_TEAM_CONFIG // update team config ACTION_MANAGE_UPDATE_TEAM_DOMAIN // update team domain // Team Member Attribute ACTION_MANAGE_REMOVE_MEMBER // remove member from a team ACTION_MANAGE_ROLE // manage role of team member ACTION_MANAGE_ROLE_FROM_OWNER // modify team member role from owner .. ACTION_MANAGE_ROLE_FROM_ADMIN // modify team member role from admin .. ACTION_MANAGE_ROLE_FROM_EDITOR // modify team member role from editor .. ACTION_MANAGE_ROLE_FROM_VIEWER // modify team member role from viewer .. ACTION_MANAGE_ROLE_TO_OWNER // modify team member role to owner ACTION_MANAGE_ROLE_TO_ADMIN // modify team member role to admin ACTION_MANAGE_ROLE_TO_EDITOR // modify team member role to editor ACTION_MANAGE_ROLE_TO_VIEWER // modify team member role to viewer // User Attribute ACTION_MANAGE_RENAME_USER // rename ACTION_MANAGE_UPDATE_USER_AVATAR // update avatar // Invite Attribute ACTION_MANAGE_CONFIG_INVITE // config invite ACTION_MANAGE_INVITE_LINK // config invite link, open, close and renew // Domain Attribute ACTION_MANAGE_TEAM_DOMAIN // update team domain ACTION_MANAGE_APP_DOMAIN // update app domain // Billing Attribute ACTION_MANAGE_PAYMENT_INFO // manage team payment info // Dashboard Attribute ACTION_MANAGE_DASHBOARD_BROADCAST // App Attribute ACTION_MANAGE_CREATE_APP // create APP ACTION_MANAGE_EDIT_APP // edit APP // Resource Attribute ACTION_MANAGE_CREATE_RESOURCE // create resource ACTION_MANAGE_EDIT_RESOURCE // edit resource // Action Attribute ACTION_MANAGE_CREATE_ACTION // create action ACTION_MANAGE_EDIT_ACTION // edit action ACTION_MANAGE_PREVIEW_ACTION // preview action ACTION_MANAGE_RUN_ACTION // run action )
action manage
View Source
const ( // Basic Attribute ACTION_DELETE = iota + 1 // delete Attribute // Domain Attribute ACTION_DELETE_TEAM_DOMAIN // delete Team Domain ACTION_DELETE_APP_DOMAIN // delete App Domain )
action delete
View Source
const ( // Team Attribute ACTION_SPECIAL_EDITOR_AND_VIEWER_CAN_INVITE_BY_LINK_SW = iota + 1 // the "editor and viewer can invite" switch // Team Member Attribute ACTION_SPECIAL_TRANSFER_OWNER // transfer team owner to others // Invite Attribute ACTION_SPECIAL_INVITE_LINK_RENEW // renew the invite link // APP Attribute ACTION_SPECIAL_RELEASE_APP // release APP )
action manage special (only owner and admin can access by default)
View Source
const DEFAULT_TEAM_ID = 0
default
View Source
const DEFAULT_UNIT_ID = 0
View Source
const STATUS_OK = 1
user status in team
View Source
const STATUS_PENDING = 2
View Source
const STATUS_SUSPEND = 3
Variables ¶
View Source
var InviteRoleAttributeMap = map[int]int{ USER_ROLE_OWNER: ACTION_ACCESS_INVITE_OWNER, USER_ROLE_ADMIN: ACTION_ACCESS_INVITE_ADMIN, USER_ROLE_EDITOR: ACTION_ACCESS_INVITE_EDITOR, USER_ROLE_VIEWER: ACTION_ACCESS_INVITE_VIEWER, }
this config map target role to target invite role attribute e.g. you want invite USER_ROLE_ADMIN, so it's mapped attribute is ACTION_ACCESS_INVITE_ADMIN
View Source
var MadifyRoleToAttributeMap = map[int]int{ USER_ROLE_OWNER: ACTION_MANAGE_ROLE_TO_OWNER, USER_ROLE_ADMIN: ACTION_MANAGE_ROLE_TO_ADMIN, USER_ROLE_EDITOR: ACTION_MANAGE_ROLE_TO_EDITOR, USER_ROLE_VIEWER: ACTION_MANAGE_ROLE_TO_VIEWER, }
View Source
var ModifyRoleFromAttributeMap = map[int]int{ USER_ROLE_OWNER: ACTION_MANAGE_ROLE_FROM_OWNER, USER_ROLE_ADMIN: ACTION_MANAGE_ROLE_FROM_ADMIN, USER_ROLE_EDITOR: ACTION_MANAGE_ROLE_FROM_EDITOR, USER_ROLE_VIEWER: ACTION_MANAGE_ROLE_FROM_VIEWER, }
this config map target role to target manage user role attribute e.g. you want modify a user to role USER_ROLE_EDITOR, so it's mapped attribute is ACTION_MANAGE_ROLE_TO_EDITOR
Functions ¶
This section is empty.
Types ¶
type AttributeGroup ¶
type AttributeGroup struct { TeamID int UserAuthToken string UserRole int UnitType int UnitID int Remote *supervisior.Supervisior }
func NewAttributeGroup ¶
func NewAttributeGroupForController ¶
func NewAttributeGroupForController(teamID int, userAuthToken string, unitType int) (*AttributeGroup, error)
func NewRawAttributeGroup ¶
func NewRawAttributeGroup() (*AttributeGroup, error)
func (*AttributeGroup) CanAccess ¶
func (attrg *AttributeGroup) CanAccess(attribute int) (bool, error)
func (*AttributeGroup) CanDelete ¶
func (attrg *AttributeGroup) CanDelete(attribute int) (bool, error)
func (*AttributeGroup) CanInvite ¶
func (attrg *AttributeGroup) CanInvite(userRole int) (bool, error)
func (*AttributeGroup) CanManage ¶
func (attrg *AttributeGroup) CanManage(attribute int) (bool, error)
func (*AttributeGroup) CanManageSpecial ¶
func (attrg *AttributeGroup) CanManageSpecial(attribute int) (bool, error)
func (*AttributeGroup) CanModify ¶
func (attrg *AttributeGroup) CanModify(attribute, fromID, toID int) (bool, error)
func (*AttributeGroup) DoesNowUserAreEditorOrViewer ¶
func (attrg *AttributeGroup) DoesNowUserAreEditorOrViewer() bool
func (*AttributeGroup) Init ¶
func (attrg *AttributeGroup) Init()
func (*AttributeGroup) SetTeamID ¶
func (attrg *AttributeGroup) SetTeamID(teamID int)
func (*AttributeGroup) SetUnitID ¶
func (attrg *AttributeGroup) SetUnitID(unitID int)
func (*AttributeGroup) SetUnitType ¶
func (attrg *AttributeGroup) SetUnitType(unitType int)
func (*AttributeGroup) SetUserAuthToken ¶
func (attrg *AttributeGroup) SetUserAuthToken(token string)
func (*AttributeGroup) SetUserRole ¶
func (attrg *AttributeGroup) SetUserRole(userRole int)
Click to show internal directories.
Click to hide internal directories.