Package sage.api

Class Security


  • public class Security
    extends java.lang.Object
    Calls for dealing with permission based access to various capabilities in the SageTV platform and UI.
    • Constructor Summary

      Constructors 
      Constructor Description
      Security()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean AddSecurityProfile​(java.lang.String Profile)
      Adds a new security profile with the specified name.
      java.lang.String GetActiveSecurityProfile()
      Returns the name of the current security profile for the UI client making the API call.
      java.lang.String GetDefaultSecurityProfile()
      Returns the name of the default security profile to use when a new client connects that does not have an associated security profile.
      java.lang.String[] GetPredefinedPermissions()
      Returns a list of all the predefined permission names.
      java.lang.String[] GetSecurityProfiles()
      Returns the names of the different security profiles.
      boolean HasPermission​(java.lang.String Permission)
      Returns true if the specified permission is allowed under the security profile active for the UI making this API call.
      boolean HasPermission​(java.lang.String Permission, java.lang.String Profile)
      Returns true if the specified permission is allowed under the specified security profile.
      boolean RemoveSecurityProfile​(java.lang.String Profile)
      Removes the security profile with the specified name.
      boolean SetActiveSecurityProfile​(java.lang.String Profile)
      Sets the name of the current security profile for the UI client making the API call.
      boolean SetDefaultSecurityProfile​(java.lang.String Profile)
      Sets the name of the default security profile to use when a new client connects that does not have an associated security profile.
      void SetPermission​(java.lang.String Permission, java.lang.String Profile, boolean Allowed)
      Sets whether or not a permission is allowed under a specific security profile.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Security

        public Security()
    • Method Detail

      • GetActiveSecurityProfile

        public java.lang.String GetActiveSecurityProfile()
        Returns the name of the current security profile for the UI client making the API call.
        Returns:
        the name of the current security profile for the UI client making the API call, returns null if there's no valid UI context for this call
        Since:
        7.1
      • GetDefaultSecurityProfile

        public java.lang.String GetDefaultSecurityProfile()
        Returns the name of the default security profile to use when a new client connects that does not have an associated security profile.
        Returns:
        the name of the default security profile to use when a new client connects that does not have an associated security profile
        Since:
        7.1
      • SetActiveSecurityProfile

        public boolean SetActiveSecurityProfile​(java.lang.String Profile)
        Sets the name of the current security profile for the UI client making the API call.
        Parameters:
        Profile - the name of the security profile
        Returns:
        true if the call succeeded; false if the specified profile does not exist or there is no valid UI context for this call
        Since:
        7.1
      • SetDefaultSecurityProfile

        public boolean SetDefaultSecurityProfile​(java.lang.String Profile)
        Sets the name of the default security profile to use when a new client connects that does not have an associated security profile.
        Parameters:
        Profile - the name of the default security profile to use when a new client connects that does not have an associated security profile
        Returns:
        true if the call succeeds, false if the specified profile does not exist
        Since:
        7.1
      • GetSecurityProfiles

        public java.lang.String[] GetSecurityProfiles()
        Returns the names of the different security profiles.
        Returns:
        the names of the different security profiles
        Since:
        7.1
      • AddSecurityProfile

        public boolean AddSecurityProfile​(java.lang.String Profile)
        Adds a new security profile with the specified name. Unless this profile existed before; all permissions will default to false. If the profile existed before; it's old settings will be the initial settings for this new profile.
        Parameters:
        Profile - the name for the new security profile
        Returns:
        true if this was added as a new security profile, false otherwise (it'll only fail if the name is already in use)
        Since:
        7.1
      • RemoveSecurityProfile

        public boolean RemoveSecurityProfile​(java.lang.String Profile)
        Removes the security profile with the specified name. You cannot remove the Administrator profile. If a user session is currently active under the profile being removed; it will continue to remain active under that profile with the current permissions until that user session expires.
        Parameters:
        Profile - the name for the security profile to remove
        Returns:
        true if this was removed as a security profile, false otherwise (it'll only fail if the name isn't in use or is Administrator)
        Since:
        7.1
      • GetPredefinedPermissions

        public java.lang.String[] GetPredefinedPermissions()
        Returns a list of all the predefined permission names. Plugins are free to define their own new permissions using any string they like; but those will not be returned from this API call.
        Returns:
        a list of all the predefined permission names
        Since:
        7.1
      • SetPermission

        public void SetPermission​(java.lang.String Permission,
                                  java.lang.String Profile,
                                  boolean Allowed)
        Sets whether or not a permission is allowed under a specific security profile.
        Parameters:
        Permission - the name of the permission to set
        Profile - the name of the security profile this permission applies to
        Allowed - true if the permission should be granted, false if it should be denied
        Since:
        7.1
      • HasPermission

        public boolean HasPermission​(java.lang.String Permission,
                                     java.lang.String Profile)
        Returns true if the specified permission is allowed under the specified security profile. If this permission has not been explicitly set to false for that profile; this method will return true. The return value is undefined if the specified profile is invalid.
        Parameters:
        Permission - the name of the permission
        Profile - the of the security profile
        Returns:
        false if the specified permission is denied under the specified profile, true otherwise
        Since:
        7.1
      • HasPermission

        public boolean HasPermission​(java.lang.String Permission)
        Returns true if the specified permission is allowed under the security profile active for the UI making this API call. If this permission has not been explicitly set to false for that profile; this method will return true.
        Parameters:
        Permission - the name of the permission
        Returns:
        false if the specified permission is denied under the active security profile or if the current context has no security profile, true otherwise
        Since:
        7.1