gws.plugin.model_field.integer

Integer field.

Source code: gws.plugin.model_field.integer

Package Contents

class gws.plugin.model_field.integer.User

Bases: Object

User object.

attributes: dict

Custom user attributes.

authToken: str

Token used for authorization.

displayName: str

User display name.

isGuest: bool

User is a Guest.

localUid: str

User uid within its authorization provider.

loginName: str

User login name.

provider: AuthProvider

User authorization provider.

roles: set[str]

User roles.

uid: str

Global user uid.

acl_bit(access: Access, obj: Object) int | None

Get the ACL bit for a specific object.

Parameters:
  • access – Access mode.

  • obj – Requested object.

Returns:

1 or 0 if the user’s permissions have the bit and None otherwise.

can(access: Access, obj: Object, *context) bool

Check if the user can access an object.

Parameters:
  • access – Access mode.

  • obj – Requested object.

  • *context – Further objects to check.

Returns:

True is access is granted.

can_create(obj: Object, *context) bool

Check if the user has “create” permission on an object.

can_delete(obj: Object, *context) bool

Check if the user has “delete” permission on an object.

can_read(obj: Object, *context) bool

Check if the user has “read” permission on an object.

can_use(obj: Object, *context) bool

Check if the user has “read” permission on an object.

can_write(obj: Object, *context) bool

Check if the user has “write” permission on an object.

can_edit(obj: Object, *context) bool

Check if the user has “edit” permissions on an object.

acquire(uid: str = None, classref: ClassRef | None = None, access: Access | None = None) Object | None

Get a readable object by uid.

Parameters:
  • uid – Object uid.

  • classref – Class reference. If provided, ensures that the object matches the reference.

  • access – Access mode, assumed Access.read if omitted.

Returns:

A readable object or None if the object does not exists or user doesn’t have a permission.

require(uid: str = None, classref: ClassRef | None = None, access: Access | None = None) Object

Get a readable object by uid and fail if not found.

Parameters:
  • uid – Object uid.

  • classref – Class reference. If provided, ensures that the object matches the reference.

  • access – Access mode, assumed Access.read if omitted.

Returns:

A readable object.

Raises:
  • NotFoundError if the object doesn't exist.

  • ForbiddenError if the user cannot read the object.

require_project(uid: str = None) Project

Get a readable Project object.

Parameters:

uid – Project uid.

Returns:

A Project object.

require_layer(uid=None) Layer

Get a readable Layer object.

Parameters:

uid – Layer uid.

Returns:

A Layer object.

class gws.plugin.model_field.integer.Config(*args, **kwargs)

Bases: gws.base.model.scalar_field.Config

Basic config with permissions.

class gws.plugin.model_field.integer.Props(*args, **kwargs)

Bases: gws.base.model.scalar_field.Props

Object properties.

class gws.plugin.model_field.integer.Object

Bases: gws.base.model.scalar_field.Object

Model field.

attributeType
configure_widget()
convert(val, mc)