| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
GI.Gio.Objects.Permission
Description
A Permission represents the status of the caller's permission to
 perform a certain action.
You can query if the action is currently allowed and if it is possible to acquire the permission so that the action will be allowed in the future.
There is also an API to actually acquire the permission and one to release it.
As an example, a Permission might represent the ability for the
 user to write to a Settings object.  This Permission object could
 then be used to decide if it is appropriate to show a "Click here to
 unlock" button in a dialog and to provide the mechanism to invoke
 when that button is clicked.
Synopsis
- newtype Permission = Permission (ManagedPtr Permission)
 - class (GObject o, IsDescendantOf Permission o) => IsPermission o
 - toPermission :: (MonadIO m, IsPermission o) => o -> m Permission
 - noPermission :: Maybe Permission
 - permissionAcquire :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> m ()
 - permissionAcquireAsync :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
 - permissionAcquireFinish :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) => a -> b -> m ()
 - permissionGetAllowed :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
 - permissionGetCanAcquire :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
 - permissionGetCanRelease :: (HasCallStack, MonadIO m, IsPermission a) => a -> m Bool
 - permissionImplUpdate :: (HasCallStack, MonadIO m, IsPermission a) => a -> Bool -> Bool -> Bool -> m ()
 - permissionRelease :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> m ()
 - permissionReleaseAsync :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
 - permissionReleaseFinish :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) => a -> b -> m ()
 - getPermissionAllowed :: (MonadIO m, IsPermission o) => o -> m Bool
 - getPermissionCanAcquire :: (MonadIO m, IsPermission o) => o -> m Bool
 - getPermissionCanRelease :: (MonadIO m, IsPermission o) => o -> m Bool
 
Exported types
newtype Permission Source #
Memory-managed wrapper type.
Constructors
| Permission (ManagedPtr Permission) | 
Instances
| Eq Permission Source # | |
Defined in GI.Gio.Objects.Permission  | |
| GObject Permission Source # | |
Defined in GI.Gio.Objects.Permission Methods gobjectType :: IO GType #  | |
| IsGValue Permission Source # | Convert   | 
Defined in GI.Gio.Objects.Permission  | |
| HasParentTypes Permission Source # | |
Defined in GI.Gio.Objects.Permission  | |
| type ParentTypes Permission Source # | |
Defined in GI.Gio.Objects.Permission  | |
class (GObject o, IsDescendantOf Permission o) => IsPermission o Source #
Type class for types which can be safely cast to Permission, for instance with toPermission.
Instances
| (GObject o, IsDescendantOf Permission o) => IsPermission o Source # | |
Defined in GI.Gio.Objects.Permission  | |
toPermission :: (MonadIO m, IsPermission o) => o -> m Permission Source #
Cast to Permission, for types for which this is known to be safe. For general casts, use castTo.
noPermission :: Maybe Permission Source #
A convenience alias for Nothing :: Maybe Permission.
Methods
Overloaded methods
acquire
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
| => a | 
  | 
| -> Maybe b | 
  | 
| -> m () | (Can throw   | 
Attempts to acquire the permission represented by permission.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. A simple example is that a dialog may appear asking the user to enter their password.
You should check with permissionGetCanAcquire before calling
 this function.
If the permission is acquired then True is returned.  Otherwise,
 False is returned and error is set appropriately.
This call is blocking, likely for a very long time (in the case that
 user interaction is required).  See permissionAcquireAsync for
 the non-blocking version.
Since: 2.26
acquireAsync
permissionAcquireAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
| => a | 
  | 
| -> Maybe b | 
  | 
| -> Maybe AsyncReadyCallback | 
  | 
| -> m () | 
Attempts to acquire the permission represented by permission.
This is the first half of the asynchronous version of
 permissionAcquire.
Since: 2.26
acquireFinish
permissionAcquireFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) | |
| => a | 
  | 
| -> b | 
  | 
| -> m () | (Can throw   | 
Collects the result of attempting to acquire the permission
 represented by permission.
This is the second half of the asynchronous version of
 permissionAcquire.
Since: 2.26
getAllowed
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a) | |
| => a | 
  | 
| -> m Bool | Returns: the value of the 'allowed' property  | 
Gets the value of the 'allowed' property.  This property is True if
 the caller currently has permission to perform the action that
 permission represents the permission to perform.
Since: 2.26
getCanAcquire
permissionGetCanAcquire Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a) | |
| => a | 
  | 
| -> m Bool | Returns: the value of the 'can-acquire' property  | 
Gets the value of the 'can-acquire' property.  This property is True
 if it is generally possible to acquire the permission by calling
 permissionAcquire.
Since: 2.26
getCanRelease
permissionGetCanRelease Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a) | |
| => a | 
  | 
| -> m Bool | Returns: the value of the 'can-release' property  | 
Gets the value of the 'can-release' property.  This property is True
 if it is generally possible to release the permission by calling
 permissionRelease.
Since: 2.26
implUpdate
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a) | |
| => a | 
  | 
| -> Bool | 
  | 
| -> Bool | 
  | 
| -> Bool | 
  | 
| -> m () | 
This function is called by the Permission implementation to update
 the properties of the permission.  You should never call this
 function except from a Permission implementation.
GObject notify signals are generated, as appropriate.
Since: 2.26
release
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
| => a | 
  | 
| -> Maybe b | 
  | 
| -> m () | (Can throw   | 
Attempts to release the permission represented by permission.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. In most cases the permission will be dropped immediately without further action.
You should check with permissionGetCanRelease before calling
 this function.
If the permission is released then True is returned.  Otherwise,
 False is returned and error is set appropriately.
This call is blocking, likely for a very long time (in the case that
 user interaction is required).  See permissionReleaseAsync for
 the non-blocking version.
Since: 2.26
releaseAsync
permissionReleaseAsync Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsCancellable b) | |
| => a | 
  | 
| -> Maybe b | 
  | 
| -> Maybe AsyncReadyCallback | 
  | 
| -> m () | 
Attempts to release the permission represented by permission.
This is the first half of the asynchronous version of
 permissionRelease.
Since: 2.26
releaseFinish
permissionReleaseFinish Source #
Arguments
| :: (HasCallStack, MonadIO m, IsPermission a, IsAsyncResult b) | |
| => a | 
  | 
| -> b | 
  | 
| -> m () | (Can throw   | 
Collects the result of attempting to release the permission
 represented by permission.
This is the second half of the asynchronous version of
 permissionRelease.
Since: 2.26
Properties
allowed
True if the caller currently has permission to perform the action that
 permission represents the permission to perform.
getPermissionAllowed :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “allowed” property.
 When overloading is enabled, this is equivalent to
get permission #allowed
canAcquire
True if it is generally possible to acquire the permission by calling
 permissionAcquire.
getPermissionCanAcquire :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “can-acquire” property.
 When overloading is enabled, this is equivalent to
get permission #canAcquire
canRelease
True if it is generally possible to release the permission by calling
 permissionRelease.
getPermissionCanRelease :: (MonadIO m, IsPermission o) => o -> m Bool Source #
Get the value of the “can-release” property.
 When overloading is enabled, this is equivalent to
get permission #canRelease