List enabled features.

        List all features that are enabled on a given Account, Course, or User.
        Only the feature names are returned.
430735
def list_enabled_features_accounts(self, account_id):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - account_id
        """ID"""
        path["account_id"] = account_id

        self.logger.debug("GET /api/v1/accounts/{account_id}/features/enabled with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("GET", "/api/v1/accounts/{account_id}/features/enabled".format(**path), data=data, params=params, no_data=True)
1016998
public static function get_features_list() {
        global $CFG;

        $general = new lang_string('general');
        $mainmenu = new lang_string('mainmenu', 'tool_mobile');
        $course = new lang_string('course');
        $modules = new lang_string('managemodules');
        $blocks = new lang_string('blocks');
        $user = new lang_string('user');
        $files = new lang_string('files');
        $remoteaddons = new lang_string('remoteaddons', 'tool_mobile');

        $availablemods = core_plugin_manager::instance()->get_plugins_of_type('mod');
        $coursemodules = array();
        $appsupportedmodules = array('assign', 'book', 'chat', 'choice', 'data', 'feedback', 'folder', 'forum', 'glossary', 'imscp',
            'label', 'lesson', 'lti', 'page', 'quiz', 'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop');

        foreach ($availablemods as $mod) {
            if (in_array($mod->name, $appsupportedmodules)) {
                $coursemodules['$mmCourseDelegate_mmaMod' . ucfirst($mod->name)] = $mod->displayname;
            }
        }
        asort($coursemodules);

        $remoteaddonslist = array();
        $mobileplugins = self::get_plugins_supporting_mobile();
        foreach ($mobileplugins as $plugin) {
            $displayname = core_plugin_manager::instance()->plugin_name($plugin['component']) . " - " . $plugin['addon'];
            $remoteaddonslist['sitePlugin_' . $plugin['component'] . '_' . $plugin['addon']] = $displayname;

        }

        // Display blocks.
        $availableblocks = core_plugin_manager::instance()->get_plugins_of_type('block');
        $courseblocks = array();
        $appsupportedblocks = array(
            'activity_modules' => 'CoreBlockDelegate_AddonBlockActivityModules',
            'site_main_menu' => 'CoreBlockDelegate_AddonBlockSiteMainMenu',
            'myoverview' => 'CoreBlockDelegate_AddonBlockMyOverview',
            'timeline' => 'CoreBlockDelegate_AddonBlockTimeline',
            'recentlyaccessedcourses' => 'CoreBlockDelegate_AddonBlockRecentlyAccessedCourses',
            'starredcourses' => 'CoreBlockDelegate_AddonBlockStarredCourses',
            'recentlyaccesseditems' => 'CoreBlockDelegate_AddonBlockRecentlyAccessedItems',
            'badges' => 'CoreBlockDelegate_AddonBlockBadges',
            'blog_menu' => 'CoreBlockDelegate_AddonBlockBlogMenu',
            'blog_recent' => 'CoreBlockDelegate_AddonBlockBlogRecent',
            'blog_tags' => 'CoreBlockDelegate_AddonBlockBlogTags',
            'calendar_month' => 'CoreBlockDelegate_AddonBlockCalendarMonth',
            'calendar_upcoming' => 'CoreBlockDelegate_AddonBlockCalendarUpcoming',
            'comments' => 'CoreBlockDelegate_AddonBlockComments',
            'completionstatus' => 'CoreBlockDelegate_AddonBlockCompletionStatus',
            'feedback' => 'CoreBlockDelegate_AddonBlockFeedback',
            'glossary_random' => 'CoreBlockDelegate_AddonBlockGlossaryRandom',
            'html' => 'CoreBlockDelegate_AddonBlockHtml',
            'lp' => 'CoreBlockDelegate_AddonBlockLp',
            'news_items' => 'CoreBlockDelegate_AddonBlockNewsItems',
            'online_users' => 'CoreBlockDelegate_AddonBlockOnlineUsers',
            'selfcompletion' => 'CoreBlockDelegate_AddonBlockSelfCompletion',
            'tags' => 'CoreBlockDelegate_AddonBlockTags',
        );

        foreach ($availableblocks as $block) {
            if (isset($appsupportedblocks[$block->name])) {
                $courseblocks[$appsupportedblocks[$block->name]] = $block->displayname;
            }
        }
        asort($courseblocks);

        $features = array(
            "$general" => array(
                'NoDelegate_CoreOffline' => new lang_string('offlineuse', 'tool_mobile'),
                'NoDelegate_SiteBlocks' => new lang_string('blocks'),
                'NoDelegate_CoreComments' => new lang_string('comments'),
                'NoDelegate_CoreRating' => new lang_string('ratings', 'rating'),
                'NoDelegate_CoreTag' => new lang_string('tags'),
                '$mmLoginEmailSignup' => new lang_string('startsignup'),
                'NoDelegate_ResponsiveMainMenuItems' => new lang_string('responsivemainmenuitems', 'tool_mobile'),
            ),
            "$mainmenu" => array(
                '$mmSideMenuDelegate_mmaFrontpage' => new lang_string('sitehome'),
                '$mmSideMenuDelegate_mmCourses' => new lang_string('mycourses'),
                'CoreMainMenuDelegate_CoreCoursesDashboard' => new lang_string('myhome'),
                '$mmSideMenuDelegate_mmaCalendar' => new lang_string('calendar', 'calendar'),
                '$mmSideMenuDelegate_mmaNotifications' => new lang_string('notifications', 'message'),
                '$mmSideMenuDelegate_mmaMessages' => new lang_string('messages', 'message'),
                '$mmSideMenuDelegate_mmaGrades' => new lang_string('grades', 'grades'),
                '$mmSideMenuDelegate_mmaCompetency' => new lang_string('myplans', 'tool_lp'),
                'CoreMainMenuDelegate_AddonBlog' => new lang_string('blog', 'blog'),
                '$mmSideMenuDelegate_mmaFiles' => new lang_string('files'),
                '$mmSideMenuDelegate_website' => new lang_string('webpage'),
                '$mmSideMenuDelegate_help' => new lang_string('help'),
            ),
            "$course" => array(
                'NoDelegate_CourseBlocks' => new lang_string('blocks'),
                'CoreCourseOptionsDelegate_AddonBlog' => new lang_string('blog', 'blog'),
                '$mmCoursesDelegate_search' => new lang_string('search'),
                '$mmCoursesDelegate_mmaCompetency' => new lang_string('competencies', 'competency'),
                '$mmCoursesDelegate_mmaParticipants' => new lang_string('participants'),
                '$mmCoursesDelegate_mmaGrades' => new lang_string('grades', 'grades'),
                '$mmCoursesDelegate_mmaCourseCompletion' => new lang_string('coursecompletion', 'completion'),
                '$mmCoursesDelegate_mmaNotes' => new lang_string('notes', 'notes'),
                'NoDelegate_CoreCourseDownload' => new lang_string('downloadcourse', 'tool_mobile'),
                'NoDelegate_CoreCoursesDownload' => new lang_string('downloadcourses', 'tool_mobile'),
            ),
            "$user" => array(
                'CoreCourseOptionsDelegate_AddonBlog' => new lang_string('blog', 'blog'),
                '$mmUserDelegate_mmaBadges' => new lang_string('badges', 'badges'),
                '$mmUserDelegate_mmaCompetency:learningPlan' => new lang_string('competencies', 'competency'),
                '$mmUserDelegate_mmaCourseCompletion:viewCompletion' => new lang_string('coursecompletion', 'completion'),
                '$mmUserDelegate_mmaGrades:viewGrades' => new lang_string('grades', 'grades'),
                '$mmUserDelegate_mmaMessages:sendMessage' => new lang_string('sendmessage', 'message'),
                '$mmUserDelegate_mmaMessages:addContact' => new lang_string('addcontact', 'message'),
                '$mmUserDelegate_mmaMessages:blockContact' => new lang_string('blockcontact', 'message'),
                '$mmUserDelegate_mmaNotes:addNote' => new lang_string('addnewnote', 'notes'),
                '$mmUserDelegate_picture' => new lang_string('userpic'),
            ),
            "$files" => array(
                'files_privatefiles' => new lang_string('privatefiles'),
                'files_sitefiles' => new lang_string('sitefiles'),
                'files_upload' => new lang_string('upload'),
            ),
            "$modules" => $coursemodules,
            "$blocks" => $courseblocks,
        );

        if (!empty($remoteaddonslist)) {
            $features["$remoteaddons"] = $remoteaddonslist;
        }

        return $features;
    }
977300
def list_roles_for_user(self, user):
        
        user_id = utils.get_id(user)
        uri = "users/%s/roles" % user_id
        resp, resp_body = self.method_get(uri)
        if resp.status_code in (401, 403):
            raise exc.AuthorizationFailure("You are not authorized to list "
                    "user roles.")
        roles = resp_body.get("roles")
        return roles
865852
def actions(self, context=None):
        
        assert self.installed(), "Actions not enabled on this application"
        result = {}
        if context is None:
            context = self.context

        for cat, actions in self._state["categories"].items():
            result[cat] = [a for a in actions if a.available(context)]
        return result
1124912
def get_all(cls, include_disabled=True):
        
        if cls == BaseAccount:
            raise InquisitorError('get_all on BaseAccount is not supported')

        account_type_id = db.AccountType.find_one(account_type=cls.account_type).account_type_id
        qry = db.Account.order_by(desc(Account.enabled), Account.account_type_id, Account.account_name)

        if not include_disabled:
            qry = qry.filter(Account.enabled == 1)

        accounts = qry.find(Account.account_type_id == account_type_id)

        return {res.account_id: cls(res) for res in accounts}
488188
def show_feature(self, user, feature):
        
        user_filter = {
            self.model.USER_FEATURE_FIELD: user,
        }
        return self.get_feature(feature).filter(
            models.Q(**user_filter) | models.Q(everyone=True)).exists()
106075
def features(self):
        """"""
        mycols = []
        for col in dfn.feature_names:
            if col in self:
                mycols.append(col)
        mycols.sort()
        return mycols
122226
def is_enabled(name):
    '''
    
    '''

    current_schedule = __salt__['schedule.list'](show_all=False, return_yaml=False)
    if name in current_schedule:
        return current_schedule[name]
    else:
        return {}
610540
public List<Option> getOptions(boolean includeDisabled) {
        List<Option> result = new ArrayList<>(); //Keep order

        if (!includeDisabled && !enabled) {
            return result;//This group is disabled entirely
        }

        for (Option option : options.values()) {
            if (includeDisabled || option.isEnabled()) {
                result.add(option);
            }
        }

        return result;
    }
1357101
def get_features_all(self):
        

        features = {}

        # Get all the names of features.
        all_vars = vars(self)
        for name in all_vars.keys():
            if name in feature_names_list_all:
                features[name] = all_vars[name]

        # Sort by the keys (i.e. feature names).
        features = OrderedDict(sorted(features.items(), key=lambda t: t[0]))

        return features
666807
def user_active_directory_enabled(user, attributes, created, updated):
    
    try:
        user_account_control = int(attributes['userAccountControl'][0])
        if user_account_control & 2:
            user.is_active = False
        else:
            user.is_active = True
    except KeyError:
        pass
620937
public base_response enable_features(String[] features) throws Exception
	{
		base_response result = null;
		nsfeature resource = new nsfeature();
		resource.set_feature(features);
		options option = new options();
		option.set_action("enable");
		result = resource.perform_operation(this, option);
		return result;
	}
180252
def _finalize_features(self):
        """"""

        # First, flag all the enabled items (and thus their dependencies)
        for name, feature in self.features.items():
            enabled = self.feature_is_included(name)
            if enabled or (enabled is None and feature.include_by_default()):
                feature.include_in(self)
                self._set_feature(name, 1)

        # Then disable the rest, so that off-by-default features don't
        # get flagged as errors when they're required by an enabled feature
        for name, feature in self.features.items():
            if not self.feature_is_included(name):
                feature.exclude_from(self)
                self._set_feature(name, 0)
573173
def list_supported_types(category_name):
  
  types = get_supported_types(api, category_name)
  type_names = [type.name for type in types]
  print ("Supported account types by name for '{0}': [{1}]".format(
    category_name, COMMA_WITH_SPACE.join(map(str, type_names))))
994189
def feature_types(self):
        
        r = self.session.query(distinct(models.Feature.type_)).all()
        return [x[0] for x in r]
912580
def is_enabled(self):
        
        if self.name in settings.exclude_rules:
            return False
        elif self.name in settings.rules:
            return True
        elif self.enabled_by_default and ALL_ENABLED in settings.rules:
            return True
        else:
            return False
1316576
def get_viewable_members(self, user=None):
        
        members = []
        for member in self.members.all():
            show = False
            if member.can_view_eighth:
                show = member.can_view_eighth

            if not show and user and user.is_eighth_admin:
                show = True
            if not show and user and user.is_teacher:
                show = True
            if not show and member == user:
                show = True

            if show:
                members.append(member)

        return sorted(members, key=lambda u: (u.last_name, u.first_name))